const mongoose = require("mongoose")


module.exports.putin = async function (data) {
    console.log(data);
    
    if (data.state == "1") {
        let result = await mongoose.model("storeAdminsModel").find({ status: "申请中" });
        return result;
    } else if (data.state == "2") {
        let result = await mongoose.model("platformAdminsModel").find({ status: "申请中" });
        return result;
    } else if (data.state == "3") {
        let result = await mongoose.model("shopsModel").find({ status: "申请中" });
        return result;
    }

}
// 通过
module.exports.passone = async function (data) {
    const { _id, status, state } = data
    console.log(data);
    
    if (state == "1") {
        let result = await mongoose.model("storeAdminsModel").updateOne({ _id }, { status });
        return result;
    } else if (state == "2") {
        let result = await mongoose.model("platformAdminsModel").updateOne({ _id }, { status });
        return result;
    }
    else if (state == "3") {
        let result = await mongoose.model("shopsModel").updateOne({ _id }, { status });
        return result;
    }



}